import Cookies from "js-cookie";

export function getToken(key: string) {
  return Cookies.get(key) || null;
}

export function setToken(key: string, token: string, option: object = {}) {
  return Cookies.set(key, token, option);
}

export function removeToken(key: string) {
  Cookies.remove(key);
}

export function removeAllToken() {
  const keys = Cookies.get();
  for (const key in keys) {
    if (Object.prototype.hasOwnProperty.call(keys, key)) {
      Cookies.remove(key);
    }
  }
}
